home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac-Source 1994 July
/
Mac-Source_July_1994.iso
/
C and C++
/
Libraries
/
GUSI
/
Examples
/
GUSITest.h
< prev
next >
Wrap
Text File
|
1992-09-11
|
2KB
|
71 lines
/*********************************************************************
File : GUSI - Grand Unified Socket Interface
File : GUSITest.h - Common testing gear
Author : Matthias Neeracher <neeri@iis.ethz.ch>
Started : 25Jul92 Language : MPW C
08Sep92 MN Factor out more common code
Last : 08Sep92
*********************************************************************/
typedef void (*TestCmd)(char ch1, char ch2, const char * restcmd);
#include <GUSITest_P.h>
#include <stdio.h>
extern FILE * input;
extern int inputline;
/* void COMMAND(
char ch1, char ch2, Command name
TestCmd p, Command to be run
char * s, Arguments to command
char * h); Explanation for command
Example:
COMMAND('m', 'd', MkDir, "directory", "Make a new directory");
*/
#define COMMAND(ch1,ch2,p,s,h) \
DISPATCH(ch1,ch2) = (p), \
USAGE(ch1,ch2) = (s), \
HELPMSG(ch1,ch2) = (h)
/* An useful macro for dumping variables.
Example:
DUMP(statbuf.st_dev,d);
*/
#define DUMP(EXPR, MODE) printf("# %s = %"#MODE"\n", #EXPR, EXPR)
/* Add common commands for sockets */
void AddSocketCommands();
/* Run the test. Define your commands with COMMAND and call this */
void RunTest(int argc, char ** argv);
/* Print a MPW executable location note */
void Where();
/* Print a prompt */
void Prompt();
/* Return a string of the current error number, e.g. "EINVAL" */
const char * Explain();
/* Print a usage message for a command */
void Usage(char ch1, char ch2);
/* Clean up sockets */
void CleanupSockets();
extern int sock; /* Socket to read/write to */
extern int accsock; /* Socket to accept connections on */